package com.yzf.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.yzf.entity.Employee;
import com.yzf.entity.Project;
import com.yzf.service.GoalService;
import com.yzf.util.web.ServletUtil;

public class newgoal extends HttpServlet {

	
	private static final long serialVersionUID = 1L;


	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		ServletUtil.forword(request, response, "new_goal");
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		Project p = (Project) ServletUtil.getSession(request).getAttribute("project");
		Employee e = (Employee) ServletUtil.getSession(request).getAttribute("employee");
		String desc = request.getParameter("desc");
		String name = request.getParameter("name");
		new GoalService().save(p.getId(),e.getId(),desc,name);
		
		ServletUtil.redirect(response, "/goal.jspx");
	}

}
